package day0302;

public enum MyException {

    USERNAMEORPASSWORDERROR(101, "用户名或密码错误"), SERVICEERROR(102, "业务异常");

    private String text;
    private MyException(){}

    private MyException(int code, String text){
        this.text = text;
    }

    public String getText() {
        return text;
    }

    public static MyException get(int index) {
        // 所有枚举实例
        MyException[] values = MyException.values();

        return values[index];
    }
}
